import { reactive, onMounted, onBeforeUnmount } from 'vue'

export const point = () => {
  const point = reactive({
    x: 0,
    y:0
  })
  const chosePoint = (event) => {
  point.x = event.pageX
  point.y = event.pageY
  }

  onMounted(() => {
  window.addEventListener('click', chosePoint)
  })
  onBeforeUnmount(() => {
  window.removeEventListener('click', chosePoint)
  })
  return point
}